package lab02.test12;


public class Test {

    public static void main(String[] args) {

        System.out.println("矩形类表达方式一");

        Rectangular rectangular=new Rectangular(9,7);

        System.out.println("矩形的面积为："+rectangular.area());

        System.out.println("矩形的周长为："+rectangular.perimeter());

        System.out.println("***************************");

        System.out.println("矩形类表达方式二");

        Shape a=new Rectangular(9,7);

        System.out.println("矩形的面积为："+a.area());

        System.out.println("矩形的周长为："+a.perimeter());

        System.out.println("***************************");

        System.out.println("圆类");

        Shape s=new Circle(4);
        //或者用下列语句
        //Shape s=null;
        //s=new Circle(4);

        System.out.println("圆的面积为："+s.area());

        System.out.println("圆的周长为："+s.perimeter());


    }
}
